package com.fh.module_mine.ui.activity

import com.alibaba.android.arouter.facade.annotation.Route
import com.fh.lib_base.base.BaseActivity
import com.fh.lib_base.config.AppConstants
import com.fh.module_mine.BR
import com.fh.module_mine.R
import com.fh.module_mine.databinding.MineActivitySplashBinding
import com.fh.module_mine.viewmodel.SplashViewModel
import com.gyf.immersionbar.ImmersionBar
import io.reactivex.Flowable
import io.reactivex.android.schedulers.AndroidSchedulers
import java.util.concurrent.TimeUnit

@Route(path = AppConstants.Router.Main.A_SPLASH)
class SplashActivity : BaseActivity<MineActivitySplashBinding, SplashViewModel>() {

    override fun initContentView(): Int {
        return R.layout.mine_activity_splash
    }

    override fun initParam() {
        ImmersionBar.hideStatusBar(window)
    }

    override fun initVariableId(): Int {
        return BR.viewModel
    }

    override fun initData() {
        viewModel.addSubscribe(
            Flowable.timer(1500L, TimeUnit.MILLISECONDS)
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe {
                    startContainerActivity(AppConstants.Router.Mine.F_LOGIN)
                    overridePendingTransition(R.anim.h_fragment_enter, 0)
                    finish()
                })
    }

    override fun useBaseLayout(): Boolean {
        return false
    }


}